using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._Raster._OrthoMapping
{
    /// <summary>
    /// <para>Compute Camera Model</para>
    /// <para>Estimates the exterior camera model and interior camera model from the EXIF header of the raw image and refines the camera models. The model is then applied to the mosaic dataset with an option to use a tool-generated, high-resolution digital surface model (DSM) to achieve better orthorectification.</para>
    /// <para>根据原始图像的 EXIF 标头估计外部摄像头模型和内部摄像头模型，并优化摄像头模型。然后将模型应用于镶嵌数据集，并可选择使用工具生成的高分辨率数字表面模型 （DSM） 来实现更好的正射校正。</para>
    /// </summary>    
    [DisplayName("Compute Camera Model")]
    public class ComputeCameraModel : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public ComputeCameraModel()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_mosaic_dataset">
        /// <para>Input Mosaic Dataset</para>
        /// <para><xdoc>
        ///   <para>The mosaic dataset on which to build and calculate the camera model.</para>
        ///   <para>Although not mandatory, it is recommended that you run the Apply Block Adjustment tool on the input mosaic dataset first.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于构建和计算照相机模型的镶嵌数据集。</para>
        ///   <para>尽管不是必需的，但建议您先在输入镶嵌数据集上运行应用块平差工具。</para>
        /// </xdoc></para>
        /// </param>
        public ComputeCameraModel(object _in_mosaic_dataset)
        {
            this._in_mosaic_dataset = _in_mosaic_dataset;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Compute Camera Model";

        public override string CallName => "management.ComputeCameraModel";

        public override List<string> AcceptEnvironments => ["parallelProcessingFactor", "scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_in_mosaic_dataset, _out_dsm, _gps_accuracy.GetGPValue(), _estimate.GetGPValue(), _refine.GetGPValue(), _apply_adjustment.GetGPValue(), _maximum_residual, _initial_tiepoint_resolution, _out_control_points, _out_solution_table, _out_solution_point_table, _out_flight_path, _maximum_overlap, _minimum_coverage, _remove.GetGPValue(), _in_control_points, _options, _out_mosaic_dataset];

        /// <summary>
        /// <para>Input Mosaic Dataset</para>
        /// <para><xdoc>
        ///   <para>The mosaic dataset on which to build and calculate the camera model.</para>
        ///   <para>Although not mandatory, it is recommended that you run the Apply Block Adjustment tool on the input mosaic dataset first.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于构建和计算照相机模型的镶嵌数据集。</para>
        ///   <para>尽管不是必需的，但建议您先在输入镶嵌数据集上运行应用块平差工具。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Mosaic Dataset")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_mosaic_dataset { get; set; }


        /// <summary>
        /// <para>Output DSM</para>
        /// <para>A digital surface model raster dataset generated from the adjusted images in the mosaic dataset. If Apply Adjustment is checked, this DSM will be used to replace the DEM in the geometric function to achieve better orthorectification.</para>
        /// <para>根据镶嵌数据集中的校正影像生成的数字表面模型栅格数据集。如果选中“应用调整”，则此 DSM 将用于替换几何函数中的 DEM，以实现更好的正射校正。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output DSM")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _out_dsm { get; set; } = null;


        /// <summary>
        /// <para>GPS Location Accuracy</para>
        /// <para><xdoc>
        ///   <para>Specifies the accuracy level of the input images. The tool will search for images in the neighborhood to compute matching points and automatically apply an adjustment strategy based on the accuracy level.</para>
        ///   <bulletList>
        ///     <bullet_item>High GPS accuracy— The GPS accuracy is 0 to 10 meters, and the tool uses a maximum of 4 by 3 images.</bullet_item><para/>
        ///     <bullet_item>Medium GPS accuracy—The GPS accuracy is 10 to 20 meters, and the tool uses a maximum of 4 by 6 images.</bullet_item><para/>
        ///     <bullet_item>Low GPS accuracy—The GPS accuracy is 20 to 50 meters, and the tool uses a maximum of 4 by 12 images.</bullet_item><para/>
        ///     <bullet_item>Very low GPS accuracy—The GPS accuracy is more than 50 meters, and the tool uses a maximum of 4 by 20 images.</bullet_item><para/>
        ///     <bullet_item>Very high GPS accuracy—Imagery was collected with high-accuracy, differential GPS, such as RTK or PPK. This option will hold image locations fixed during block adjustment.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定输入图像的精度级别。该工具将在附近搜索图像以计算匹配点，并根据精度级别自动应用调整策略。</para>
        ///   <bulletList>
        ///     <bullet_item>高 GPS 精度 — GPS 精度为 0 到 10 米，该工具最多使用 4 x 3 图像。</bullet_item><para/>
        ///     <bullet_item>中等 GPS 精度 - GPS 精度为 10 到 20 米，该工具最多使用 4 x 6 张影像。</bullet_item><para/>
        ///     <bullet_item>低 GPS 精度 - GPS 精度为 20 到 50 米，该工具最多使用 4 x 12 张影像。</bullet_item><para/>
        ///     <bullet_item>非常低的 GPS 精度 - GPS 精度超过 50 米，该工具最多使用 4 x 20 张图像。</bullet_item><para/>
        ///     <bullet_item>非常高的 GPS 精度 - 使用高精度差分 GPS（例如 RTK 或 PPK）采集影像。此选项将在块调整期间保持图像位置固定。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("GPS Location Accuracy")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _gps_accuracy_value _gps_accuracy { get; set; } = _gps_accuracy_value._HIGH;

        public enum _gps_accuracy_value
        {
            /// <summary>
            /// <para>High GPS accuracy</para>
            /// <para>High GPS accuracy— The GPS accuracy is 0 to 10 meters, and the tool uses a maximum of 4 by 3 images.</para>
            /// <para>高 GPS 精度 — GPS 精度为 0 到 10 米，该工具最多使用 4 x 3 图像。</para>
            /// </summary>
            [Description("High GPS accuracy")]
            [GPEnumValue("HIGH")]
            _HIGH,

            /// <summary>
            /// <para>Medium GPS accuracy</para>
            /// <para>Medium GPS accuracy—The GPS accuracy is 10 to 20 meters, and the tool uses a maximum of 4 by 6 images.</para>
            /// <para>中等 GPS 精度 - GPS 精度为 10 到 20 米，该工具最多使用 4 x 6 张影像。</para>
            /// </summary>
            [Description("Medium GPS accuracy")]
            [GPEnumValue("MEDIUM")]
            _MEDIUM,

            /// <summary>
            /// <para>Low GPS accuracy</para>
            /// <para>Low GPS accuracy—The GPS accuracy is 20 to 50 meters, and the tool uses a maximum of 4 by 12 images.</para>
            /// <para>低 GPS 精度 - GPS 精度为 20 到 50 米，该工具最多使用 4 x 12 张影像。</para>
            /// </summary>
            [Description("Low GPS accuracy")]
            [GPEnumValue("LOW")]
            _LOW,

            /// <summary>
            /// <para>Very low GPS accuracy</para>
            /// <para>Very low GPS accuracy—The GPS accuracy is more than 50 meters, and the tool uses a maximum of 4 by 20 images.</para>
            /// <para>非常低的 GPS 精度 - GPS 精度超过 50 米，该工具最多使用 4 x 20 张图像。</para>
            /// </summary>
            [Description("Very low GPS accuracy")]
            [GPEnumValue("VERY_LOW")]
            _VERY_LOW,

            /// <summary>
            /// <para>Very high GPS accuracy</para>
            /// <para>Very high GPS accuracy—Imagery was collected with high-accuracy, differential GPS, such as RTK or PPK. This option will hold image locations fixed during block adjustment.</para>
            /// <para>非常高的 GPS 精度 - 使用高精度差分 GPS（例如 RTK 或 PPK）采集影像。此选项将在块调整期间保持图像位置固定。</para>
            /// </summary>
            [Description("Very high GPS accuracy")]
            [GPEnumValue("VERY_HIGH")]
            _VERY_HIGH,

        }

        /// <summary>
        /// <para>Estimate Camera Model</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the camera model will be estimated by computing the adjustment based on eight times the mosaic dataset's source resolution. Computing the adjustment at this level will be faster but less accurate.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—The camera model will be estimated. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—The camera model will not be estimated.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是否通过基于镶嵌数据集源分辨率的 8 倍计算校正来估计相机模型。在此级别计算调整会更快，但准确性较低。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 将估计照相机模型。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中 - 将不估计照相机模型。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Estimate Camera Model")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _estimate_value _estimate { get; set; } = _estimate_value._true;

        public enum _estimate_value
        {
            /// <summary>
            /// <para>ESTIMATE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("ESTIMATE")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_ESTIMATE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_ESTIMATE")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Refine Camera Model</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the camera model will be refined by computing the adjustment at the mosaic dataset resolution. Computing the adjustment at this level will provide the most accurate result.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—The computed at the source resolution. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—The adjustment will not be computed at the source resolution. This option will be faster, so it is a good option when the computation does not need to be performed at the source resolution.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是否通过计算镶嵌数据集分辨率下的调整来优化照相机模型。在此级别计算调整将提供最准确的结果。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 在源分辨率下计算的。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中 - 不会在源分辨率下计算校正。此选项会更快，因此当不需要在源分辨率下执行计算时，这是一个不错的选择。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Refine Camera Model")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _refine_value _refine { get; set; } = _refine_value._true;

        public enum _refine_value
        {
            /// <summary>
            /// <para>REFINE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("REFINE")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_REFINE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_REFINE")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Apply Adjustment</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the adjusted transformation will be applied to the mosaic dataset.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—The calculated adjustment will be applied to the input mosaic dataset. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—The calculated adjustment will not be applied to the input mosaic dataset.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是否将调整后的变换应用于镶嵌数据集。</para>
        ///   <bulletList>
        ///     <bullet_item>选中—计算的校正将应用于输入镶嵌数据集。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中—计算的校正不会应用于输入镶嵌数据集。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Apply Adjustment")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _apply_adjustment_value _apply_adjustment { get; set; } = _apply_adjustment_value._true;

        public enum _apply_adjustment_value
        {
            /// <summary>
            /// <para>APPLY</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("APPLY")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_APPLY</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_APPLY")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Maximum Residual</para>
        /// <para>The maximum residual value allowed to keep a computed control point as a valid control point. The default is 5.</para>
        /// <para>允许将计算的控制点保留为有效控制点的最大残差值。默认值为 5。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Residual")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _maximum_residual { get; set; } = 5;


        /// <summary>
        /// <para>Initial Tie Point Resolution</para>
        /// <para><xdoc>
        ///   <para>The resolution factor at which tie points are generated when estimating the camera model. The default value is 8, which means eight times the source pixel resolution.</para>
        ///   <para>For images with only minor differentiation of features, such as agriculture fields, a lower value such as 2 can be used.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>估算照相机型号时生成连接点的分辨率因子。默认值为 8，表示源像素分辨率的 8 倍。</para>
        ///   <para>对于要素差异很小的图像（例如农田），可以使用较低的值（例如 2）。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Initial Tie Point Resolution")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _initial_tiepoint_resolution { get; set; } = 8;


        /// <summary>
        /// <para>Output Control Point Table</para>
        /// <para>The optional control points feature class.</para>
        /// <para>可选控制点要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Control Point Table")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _out_control_points { get; set; } = null;


        /// <summary>
        /// <para>Output Solution Table</para>
        /// <para>The optional adjustment solution table. The solution table contains the root mean square (RMS) of the adjustment error and solution matrix.</para>
        /// <para>可选的调整解决方案表。求解表包含调整误差和求解矩阵的均方根 （RMS）。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Solution Table")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _out_solution_table { get; set; } = null;


        /// <summary>
        /// <para>Output Solution Point Table</para>
        /// <para>The optional solution point feature class. The solution points are the final controls points used to generate the adjustment solution.</para>
        /// <para>可选解决方案点要素类。求解点是用于生成调整解的最终控制点。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Solution Point Table")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _out_solution_point_table { get; set; } = null;


        /// <summary>
        /// <para>Output Flight Path</para>
        /// <para>The optional flight path line feature class.</para>
        /// <para>可选飞行路径线要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Flight Path")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _out_flight_path { get; set; } = null;


        /// <summary>
        /// <para>Maximum Area Overlap</para>
        /// <para><xdoc>
        ///   <para>The percentage of overlap between two images to consider them duplicates.</para>
        ///   <para>For example, if the value is 0.9, it means if an image is 90 percent covered by another image, it will be considered a duplicate and removed.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将两个图像视为重复的图像之间的重叠百分比。</para>
        ///   <para>例如，如果该值为 0.9，则表示如果一个图像被另一个图像覆盖了 90%，则该图像将被视为重复项并被删除。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Area Overlap")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double? _maximum_overlap { get; set; } = null;


        /// <summary>
        /// <para>Minimum Control Point Coverage</para>
        /// <para>The percentage indicating the control point's coverage on an image. If the coverage is less than the minimum percentage, the image will be unresolved and removed. The default is 0.05, which is 5 percent.</para>
        /// <para>指示控制点在影像上的覆盖率的百分比。如果覆盖率小于最小百分比，则图像将被取消解析并被删除。默认值为 0.05，即 5%。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Minimum Control Point Coverage")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _minimum_coverage { get; set; } = 0.05;


        /// <summary>
        /// <para>Remove Off-Strip Images</para>
        /// <para><xdoc>
        ///   <para>Specifies whether images will be automatically removed if they are too far from the flight strip.</para>
        ///   <bulletList>
        ///     <bullet_item>Unchecked—Images will not be removed. This is the default.</bullet_item><para/>
        ///     <bullet_item>Checked—Images that are too far away from the flight strip will be removed.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定如果图像离飞行跑道太远，是否将自动删除图像。</para>
        ///   <bulletList>
        ///     <bullet_item>未选中 - 不会移除影像。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>选中 - 将移除离飞行跑道太远的影像。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Remove Off-Strip Images")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _remove_value _remove { get; set; } = _remove_value._false;

        public enum _remove_value
        {
            /// <summary>
            /// <para>REMOVE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("REMOVE")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_REMOVE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_REMOVE")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Input Tie Point Table</para>
        /// <para>The tie point table used to compute the camera model. If a tie point table is not specified, the tool will compute its own tie points and estimate the camera model.</para>
        /// <para>用于计算照相机模型的连接点表。如果未指定连接点表，则该工具将计算自己的连接点并估计相机模型。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Tie Point Table")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _in_control_points { get; set; } = null;


        /// <summary>
        /// <para>Additional Options</para>
        /// <para>Additional options for the adjustment engine. These options are only for use by third-party adjustment engines.</para>
        /// <para>调整引擎的附加选项。这些选项仅供第三方调整引擎使用。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Additional Options")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _options { get; set; } = null;


        /// <summary>
        /// <para>Output Camera Model</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Camera Model")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_mosaic_dataset { get; set; }


        public ComputeCameraModel SetEnv(object parallelProcessingFactor = null, object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(parallelProcessingFactor: parallelProcessingFactor, scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}